home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Special 21
/
AMIGAplus Sonderheft 21 (1999)(ICP)(DE)[!].iso
/
PublicDomain
/
System
/
recoverdeldir
/
arexx
/
RecoverDelDir.dopus5
< prev
next >
Wrap
Text File
|
1999-08-23
|
33KB
|
1,053 lines
/* $VER: RecoverDelDir 1.1 (23.3.1999) by Ralf Heinert */
/* Frodo@W-Specht.e.Ruhr.de | Frodo@Focus.Ruhr.de */
/* Designed for DirOpus 5.5 and AFS/PFS/SFS */
/* to recover deleted files found in :.Deldir */
/* Speichern als DOpus5:ARexx/RecoverDelDir.dopus5 */
/* Einbinden, z.B.im Lister-Popup-Menü, mittels */
/* -------------------------------------------------- */
/* ARexx DOpus5:ARexx/RecoverDelDir.dopus5 {Qp} {Ql} */
/* Abhaken: Asynchron */
/* -------------------------------------------------- */
/* und den neuen Menuepunkt */
/* nahe dem Eintrag 'Loeschen' platzieren. */
/* Kopieren Sie auch das Verzeichnis 'Defaultstrings' */
/* samt Inhalt nach DOpus5:ARexx/ */
/* Anwendung: */
/* Einen Quell-Lister öffnen */
/* oder den Quell-lister benutzen, den man gerade hat. */
/* Den oben erstellten Menüpunkt benutzen, */
/* und die zu restaurierende Datei */
/* wird in das aktuelle Verzeichnis, */
/* oder ein anderes auszuwählendes, restauriert. */
options results
options FAILAT 99
SIGNAL ON break_c
SIGNAL ON failure
SIGNAL ON halt
SIGNAL ON ioerr
SIGNAL ON syntax
NL = '0a'x
Fehler = 0
Catalog = 0
ENVPrefs = "ENV:RecoverDelDir.prefs"
ReqTitle = "Early RecoverDelDir Error"
PubScreen = "Directory Opus"
RDDPrefs = "SYS:Prefs/RecoverDelDir.prefs"
RDDgGuide = "DOpus5:Tools/RecoverDelDir/Anleitungen/RecoverDelDir.Guide"
RDDeGuide = "DOpus5:Tools/RecoverDelDir/Instructions/RecoverDelDir.Guide"
Kennung = "."||Right(CALL Pragma(ID),8)"."Time('S')
window = '00000000'x
PrefsVersion = "RDD.prefs 1.2"
PrefsLines = 6
MaxPathNameLength = 62
ProgramNameLength = 20
DefaultStrings = "DefaultStrings"
DelDirFound = 0
DelDirName.1 = ".DELDIR"
DelDirName.2 = ".Recycled"
DelDirName.3 = ""
SFSDelDirNamePath = "DOpus5:Tools/RecoverDelDir/C/"
DeviceInfoPath = "DOpus5:Tools/RecoverDelDir/C/"
PARSE ARG DOpusPort ListerHandle
/* Programm lokalisieren */
PARSE SOURCE . . . script
IF Pos('/',Script) = 0 THEN DO
VARI.0 = 0
ReqText = "Please do not put RecoverDelDir\n"||,
"into a root-directory !"
Gadgets = "OK"
CALL _RequestChoice(ReqTitle,ReqText,VARI,Gadgets)
EXIT
END
Script = Strip(Left(Script,LastPos("/",Script) + ProgramNameLength),'B')
IF ~EXISTS(''Script'') THEN DO
VARI.0 = 3
VARI.1 = Script
VARI.2 = LastPos('/',Script)" chars including the last '/'"
VARI.3 = MaxPathNameLength - ProgramNameLength +1
ReqText = "%s\n%s\n"||,
"Pathname too long !\n"||,
"RecoverDelDir.dopus5 cannot locate itself (see above).\n"||,
"Please ensure that the length of the pathname,\n"||,
"in which directory you put RecoverDelDir.dopus5 in,\n"||,
"doesn`t exceed %s chars."
Gadgets = "Save as Ram:E-RDD.error"
CALL _RequestChoice(ReqTitle,ReqText,VARI,Gadgets)
EXIT
END
Progdir = Left(Script,LastPos('/',Script)-1)
OldDir = PRAGMA('D',progdir)
erg = loadrexx(progdir||'/'DefaultStrings,'RecoverDelDir.strings','')
IF erg = 0 THEN DO
erg = loadrexx(progdir,'RecoverDelDir.strings','')
IF erg = 0 THEN DO
VARI.0 = 2
VARI.1 = progdir
VARI.2 = Defaultstrings
ReqText = "Couldn`t find the file\n"||,
"'RecoverDelDir.strings'\n"||,
"in the progdir-directory\n'%s/'\n"||,
"nor in progdir/'%s/'\n"||,
"Please read the manual"||,
"for correct installation !"
Gadgets = "Save as Ram:E-RDD.error"
CALL PRAGMA('D',OldDir)
CALL _RequestChoice(ReqTitle,ReqText,VARI,Gadgets)
EXIT 10
END
END
Call Open('WB','ENV:workbench','R')
WbVersion = ReadLn('WB')
Call Close('WB')
IF Left(WbVersion,2) > 37 THEN DO
IF ~SHOW('LIBRARIES','locale.library') THEN DO
IF EXISTS('Libs:locale.library') THEN
CALL ADDLIB('locale.library',0,-30,0)
END
IF SHOW('LIBRARIES','locale.library') THEN DO
IF Open('lg','ENV:language','R') THEN DO
language = ReadLn('lg')
Call Close('lg')
END
ELSE Language = "english"
LocalePath = progdir'catalogs/' || language || '/RecoverDelDir.catalog'
IF language ~= '' THEN
catalog = OPENCATALOG(LocalePath,'english',0)
IF catalog = 0 THEN
catalog = OPENCATALOG('RecoverDelDir.catalog','english',0)
END
ELSE Language = "english"
END
ELSE Language = "english"
CALL PRAGMA('D',OldDir)
ReqTitle = localestring(ERROR_Title) /* 72 */
apptags = 'TRCA_Name RecoverDelDir',
'TRCA_LongName RecoverDelDir.dopus5',
'TRCA_Info' '"'localestring(MSG_TRCA_Info)'"', /* 0 */
'TRCA_Version "1"',
'TRCA_Release "1"',
'TRCA_Date "23.03.1999"',
'TAG_END'
/* Ist alles Nötige vorhanden ? */
Check = Getclip('RecoverDelDir')
IF Check = ''|Check = 1 THEN DO
IF DOpusPort="" THEN DO
VARI.0 = 0
ReqText = localestring(ERROR_NoPort_1) /* 1 */
Gadgets = localestring(ERROR_NoPort_B0)
CALL _RequestChoice(ReqTitle,ReqText,VARI,Gadgets)
SAY localestring(ERROR_NoPort_2)
EXIT 10
END
IF ~Show('P',DOpusPort) THEN DO
VARI.0 = 1
VARI.1 = DOpusPort
ReqText = localestring(ERROR_WrongPort_1) /* 25 */
Gadgets = localestring(ERROR_WrongPort_B0)
IF Datatype(Dopusport,'W') & Length(DOpusport) = 9 THEN
ReqText = ReqText||localestring(ERROR_WrongPort_2)
CALL _RequestChoice(ReqTitle,ReqText,VARI,Gadgets)
EXIT 10
END
Address value DOpusPort
dopus version
DVersion = translate(result,'.',' ')
IF ( DVersion='RESULT' | DVersion < 5.5 ) THEN DO
VARI.0 = 0
ReqText = localestring(ERROR_DopusVersion_1) /* 11 */
Gadgets = localestring(ERROR_DopusVersion_B0)
CALL _RequestChoice(ReqTitle,ReqText,VARI,Gadgets)
EXIT
END
IF ~SHOW('LIBRARIES','rexxsupport.library') THEN DO
IF ~EXISTS('Libs:rexxsupport.library') THEN DO
VARI.0 = 0
ReqText = localestring(ERROR_RexxSupportLib_1) /* 9 */
Gadgets = localestring(ERROR_RexxSupportLib_B0)
CALL _RequestChoice(ReqTitle,ReqText,VARI,Gadgets)
EXIT 10
END
ELSE
CALL ADDLIB('rexxsupport.library',0,-30,0)
END
IF ~SHOW('LIBRtARIES','tritonrexx.library') THEN DO
IF ~EXISTS('Libs:tritonrexx.library') THEN DO
VARI.0 = 0
ReqText = localestring(ERROR_TritonRexxLib_1) /* 14 */
Gadgets = localestring(ERROR_TritonRexxLib_B0)
CALL _RequestChoice(ReqTitle,ReqText,VARI,Gadgets)
EXIT 10
END
ELSE
CALL ADDLIB('tritonrexx.library',10,-30,0)
END
IF ~SHOW('LIBRARIES','triton.library') THEN DO
IF ~EXISTS('Libs:triton.library') THEN DO
VARI.0 = 0
ReqText = localestring(ERROR_TritonLib_1) /* 16 */
Gadgets = localestring(ERROR_TritonLib_B0)
CALL _RequestChoice(ReqTitle,ReqText,VARI,Gadgets)
EXIT 10
END
END
END
ReqTitle = localestring(MSG_Title) /* 71 */
Address value DOpusPort
/* Für Programmstart von einem Knopf aus: */
IF ListerHandle = 0 THEN DO
lister query source stem source_handle.
If source_handle.count = 0 then DO
DO i = 1 TO 2
address command "wait 1 SEC"
lister query source stem source_handle.
If source_handle.count ~= 0 then LEAVE
END
If source_handle.count = 0 then DO
VARI.0 = 0
ReqText = localestring(ERROR_NoSourceLister_1) /* 23 */
Gadgets = localestring(ERROR_NoSourceLister_B0)
CALL _RequestChoice(ReqTitle,ReqText,VARI,Gadgets)
EXIT
END
End
END
ELSE source_handle.0 = ListerHandle
IF Listerhandle = '' THEN DO
VARI.0 = 0
ReqText = localestring(ERROR_NoListerHandle_1) /* 18 */
Gadgets = localestring(ERROR_NoListerHandle_B0)
ReqTitle = localestring(ERROR_Title)
CALL _RequestChoice(ReqTitle,ReqText,VARI,Gadgets)
EXIT 10
END
Address value DOpusPort
RESULT = ''
lister query source_handle.0 PATH
Path = RESULT
IF Path = '' THEN DO
VARI.0 = 0
ReqText = localestring(ERROR_ShellStart_1) /* 20 */
Gadgets = localestring(ERROR_ShellStart_B0)
CALL _RequestChoice(ReqTitle,ReqText,VARI,Gadgets)
say localestring(ERROR_NoPort_2)
EXIT 10
END
Call _Prefs()
/* Dateisystem und Datentraegername ermitteln */
lister set source_handle.0 busy 1
Device = Left(Path,Pos(":",Path))
Dosbefehl = DeviceInfo" "Device" TYPE NAME >Ram:T/Test"Kennung
address command Dosbefehl
IF open('Info','Ram:T/Test'||Kennung,'R') THEN DO
Zeile1 = readLn('Info')
CALL CLOSE('Info')
DosBefehl = "delete Ram:T/Test"||Kennung||" QUIET"
address command DosBefehl
END
ELSE DO
CALL _MissedProgram(DeviceInfo)
EXIT
END
GType = Word(Zeile1,1)
If Length(GType)+1 = Length(Zeile1) then DO
VARI.0 = 1
VARI.1 = Device
ReqText = localestring(ERROR_No_Valid_Device_1) /* 5 */
Gadgets = localestring(ERROR_No_AFS_PFS_SFS_B0)
CALL _RequestChoice(ReqTitle,ReqText,VARI,Gadgets)
EXIT
END
GName = SubStr(Zeile1,Length(GType)+2)
/* Auf AFS/PFS/SFS pruefen */
If Left(GType,3) ~= 'SFS' & Left(GType,3) ~= 'PFS' then DO
VARI.0 = 1
VARI.1 = Device
ReqText = localestring(ERROR_No_AFS_PFS_SFS_1) /* 28 */
Gadgets = localestring(ERROR_No_AFS_PFS_SFS_B0)
CALL _RequestChoice(ReqTitle,ReqText,VARI,Gadgets)
EXIT
END
/* SourceDelDir-Pfad festlegen */
IF Left(GType,3) = 'SFS' THEN DO
Address command SFSDelDirName' 'Device' > Ram:T/NameTest'Kennung
IF OPEN('na','Ram:T/NameTest'Kennung,'R') THEN DO
DelDirName = ReadLn('na')
CALL CLOSE('na')
Address command 'c:delete Ram:T/NameTest'Kennung' QUIET'
END
ELSE DO
CALL _MissedProgram(SFSDelDirName)
EXIT
END
IF ~Datatype(DelDirName,'W') THEN DO
SourceDelDir = Device||DelDirName
DelDirFound = 1
END
END
IF ~DelDirFound THEN DO i = 1 TO 3
SourceDelDir = Device||DelDirName.i
IF Exists(SourceDelDir) THEN DO
DelDirFound = 1
DelDirName = DelDirName.i
Leave
END
END
IF SourceDelDir = Device THEN DelDirFound = 0
IF ~DelDirFound THEN DO
VARI.0 = 5
VARI.1 = Device
VARI.2 = Device
VARI.3 = DelDirName.1
VARI.4 = DelDirName.2
VARI.5 = DelDirName.3
ReqText = localestring(ERROR_DeldirNotFound_1) /* 40 */
Gadgets = localestring(Button_Prefs_Cancel)
CALL _RequestChoice(ReqTitle,ReqText,VARI,Gadgets)
IF Open('ReqErg',"Ram:T/RDDReqerg",'R') THEN DO
IF ReadCh('ReqErg') = 1 THEN DO
IF Exists(RddPrefs) THEN
address command 'rx 'RddPrefs' 1'
ELSE
CALL _RequestChoice(localestring(Msg_Problem_Title),"Couldn`t find\n"RddPrefs,VARI,"OK")
END
CALL Close('ReqErg')
ADDRESS COMMAND "C:Delete Ram:T/RDDReqerg QUIET"
END
EXIT
END
ELSE CALL _MakeDestPath(SourceDelDir)
/* Liste einlesen */
List = showdir(SourceDelDir,'f',':')
IF length(List) = 0 THEN DO
VARI.0 = 2
VARI.1 = Device
VARI.2 = SourceDelDir
ReqText = localestring(ERROR_NoDeletedFiles_1) /* 33 */
Gadgets = localestring(ERROR_NoDeletedFiles_B0)
CALL _RequestChoice(ReqTitle,ReqText,VARI,Gadgets)
EXIT
END
/* Anzahl der Einträge, max.Filename-Länge ermitteln */
entries = 1
MaxLen = 0
SLen = 0
SList = List
IF GType = "SFS0" THEN DO
IF Pos(':',SList) = 0 THEN
MaxLen = Length(SList) + 1
DO WHILE Pos(':',SList) ~= 0
Trenn = LastPos(':',SList)
SLen = Length(SList)
rechts = SubStr(SList,Trenn)
SList = DELSTR(SList,Trenn)
FLen = Length(rechts)
IF FLen > MaxLen THEN DO
MaxLen = FLen
IF POS("$",rechts) > 0 THEN
MaxLen = MaxLen - 4
END
entries = entries + 1
END
END
ELSE DO WHILE Pos(':',SList) ~= 0
SList = DELSTR(SList,LastPos(':',SList))
entries = entries + 1
END
/* Hauptarbeit starten */
Setclip('RecoverDelDir',2)
Call _Progress()
IF i = 1 THEN DO
VARI.0 = 1
VARI.1 = SourceDelDir
ReqText = localestring(ERROR_OnlyEmptyFiles_1) /* 49 */
Gadgets = localestring(ERROR_OnlyEmptyFiles_B0)
CALL _RequestChoice(ReqTitle,ReqText,VARI,Gadgets)
EXIT
END
/* --------------- Deldir-Fenster --------------- */
_Fenster1:
IF GType = "SFS0" THEN
Titel = localestring(WIN_UpperLine_SFS) /* 64 */
ELSE
Titel = localestring(WIN_UpperLine_PFS) /* 65 */
ListViewtags = WindowID(1),
PubScreenName(PubScreen),
WindowPosition('TRWP_CENTERDISPLAY'),
WindowTitle('RecoverDelDir 'GName' ('SourceDelDir') 'GType),
BeginMenu('Project'),
MenuItem(' Guide',101),
MenuItem(' Prefs',100),
'HorizGroupA',
'Space',
'VertGroupA SpaceB',
'HorizGroupSAC Space',
TextH(localestring(WIN_DestinationLine)' ') 'Space',
ClippedTextBoxMW(Desti,58,MinWidth) 'Space',
GetDrawerButton(56) 'Space',
'EndGroup Space',
'Space',
CenteredText3(Titel),
'Space',
ListSS('list',50,0,0) 'TRAT_MinHeight 'MinLines' TRAT_Flags TRLV_FWFONT|TRLV_SHOWSELECTED',
'Space',
'VertGroupA',
'HorizGroupSAC Space',
TextH(SourceDelDir) 'Space',
ClippedTextBoxMW(Flist.1,57,MaxLen) 'SpaceB',
TextH(Text2) 'Space',
ClippedTextBoxMW(NList.1,51,Len2) 'SpaceB',
'EndGroup Space',
'EndGroup Space',
'HorizGroupA Space',
GetFileButton(55) 'Space',
Button(localestring(WIN_Button_Doubleclick),53) 'Space', /* 68 */
Button(localestring(WIN_Button_RestoreFile),54) 'Space', /* 69 */
ButtonR(localestring(WIN_Button_QuitProgram),52) 'Space', /* 70 */
'EndGroup Space',
'EndGroup',
'Space',
'EndGroup',
'EndProject'
/* Fensterverdrahtung */
app = TR_CREATEAPP(apptags)
IF app ~= '00000000'x THEN DO
ListView = TR_OPENPROJECT(app,ListViewtags)
WindowProject = C2D(ListView)
IF ListView ~= '00000000'x THEN DO
ende = 0
nummer = 1
DO WHILE ende ~= 1
CALL TR_WAIT(app,'')
DO WHILE TR_HANDLEMSG(app,'event')
IF event.trm_class = 'TRMS_CLOSEWINDOW' THEN
ende = 1
IF event.trm_class = 'TRMS_NEWVALUE' THEN DO
SELECT
WHEN event.trm_id = 50 THEN DO
nummer = event.trm_data+1
CALL TR_SETATTRIBUTE(ListView,51,'TRAT_Text',Nlist.nummer)
CALL TR_SETATTRIBUTE(ListView,57,'TRAT_Text',Flist.nummer)
END
OTHERWISE
NOP
END
END
IF event.trm_class = 'TRMS_ACTION' THEN DO
SELECT
WHEN event.trm_id = 52 THEN
ende = 1
WHEN event.trm_id = 100 THEN
Call _PrefsStart(1)
WHEN event.trm_id = 101 THEN
Call _Guide()
WHEN event.trm_id = 53 THEN DO
lister set source_handle.0 busy 0
command wait "DoubleClick" SourceDelDir'/'FList.nummer
lister set source_handle.0 busy 1
END
WHEN event.trm_id = 54 THEN DO
IF GType = "SFS0" THEN DO
Quelldatei = FList.nummer
Tempdatei = FList.nummer
END
ELSE DO
Quelldatei = FList.nummer
Tempdatei = NList.nummer
END
DosBefehl = "COPY FROM "||'"'SourceDelDir'/'Quelldatei'"'||" TO "||'"'TempDir||Tempdatei'"'||" CLONE DATES COM"
address command DosBefehl
command wait protect '"'TempDir||Tempdatei'" SET RWED'
CALL _FileRequest('"'Desti'"',Tempdatei,localestring(MSG_SaveAs_Req_Title),"#?",0,1,0) /* 61 */
IF Auswahl = 1 THEN DO
Trenn = LastPos("/",Savefile.1)
IF Trenn = 0 THEN Trenn = Pos(":",Savefile.1)
DDir = Left(Savefile.1,Trenn)
IF DDir ~= Desti THEN DO
Lister New DDir
handler = RESULT
Lister set handler dest
END
DFile = Right(Savefile.1,Length(Savefile.1)-Trenn)
IF ~Exists(DDir||DFile) THEN
address command copy 'FROM "'TempDir||Tempdatei'" TO "'DDir||DFile'"'
ELSE DO
ReqTitle = localestring(MSG_Problem_Title) /* 60 */
ReqText = localestring(MSG_FileAlreadyExists_1) /* 53 */
Gadgets = localestring(MSG_FileAlreadyExists_B0) /* 54 */
VARI.0 = 1
VARI.1 = DFile
CALL _EasyRequest(ReqTitle,ReqText,VARI,Gadgets)
IF Auswahl = 1 THEN
address command copy 'FROM "'TempDir||Tempdatei'" TO "'DDir||DFile'"'
END
Lister Refresh Source_handle.0 full
END
DosBefehl = "delete "TempDir||Tempdatei
address command DosBefehl
END
WHEN event.trm_id = 55 THEN DO
Kennung = "."||Right(CALL Pragma(ID),8)"."Time('S')
OutFile = "Ram:"||Translate(Sourcedeldir,'_',':')||Kennung
IF ~(EXISTS(OutFile)) THEN DO
CALL Open(out,outfile,'W')
DO o = 1 TO List.0
WriteLn(out,List.o)
END
CALL Close(out)
ReqTitle = localestring(MSG_ListSaved_Title) /* 59 */
ReqText = localestring(MSG_ListSaved_1) /* 57 */
Gadgets = localestring(MSG_ListSaved_B0) /* 58 */
VARI.0 = 2
VARI.1 = SourceDelDir
VARI.2 = OutFile
CALL _EasyRequest(ReqTitle,ReqText,VARI,Gadgets)
END
END
WHEN event.trm_id = 56 THEN DO
CALL _FileRequest('"'Desti'"',"''",localestring(MSG_NewDest_Req_Title),"#?",1,0,1) /* 62 */
IF Auswahl = 1 THEN DO
Desti = SaveFile.1
IF LastPos(":",Desti) ~= Length(Desti) THEN Desti = Desti'/'
CALL TR_SETATTRIBUTE(ListView,58,'TRAT_Text',Desti)
Lister New Desti
handler = RESULT
Lister set handler dest
END
END
OTHERWISE
NOP
END
END
END
END
CALL TR_UNLOCKPROJECT(ListView)
CALL TR_CLOSEPROJECT(ListView)
END
IF app ~= '00000000'x THEN CALL TR_DELETEAPP(app)
END
lister set source_handle.0 busy 0
Setclip('RecoverDelDir',0)
EXIT
/* ------------------------- Progressbar -------------------------- */
_Progress:
windowtags2 = WindowID(2),
PubScreenName(PubScreen),
WindowPosition('TRWP_CENTERDISPLAY'),
WindowFlags('TRWF_NODEPTHGADGED|TRWF_NOZIPGADGET|TRWF_NOSIZEGADGET'),
WindowTitle(localestring(MSG_Progressbar_Title)),
'HorizGroupA',
'Space',
'VertGroupA',
'Space',
Progress(entries,0,7),
'Space',
'EndGroup',
'Space',
'EndGroup',
'EndProject'
app2 = TR_CREATEAPP('TRCA_Name Progressbar')
IF app2 ~= '00000000'x THEN DO
progresswindow = TR_OPENPROJECT(app2,windowtags2)
IF progresswindow ~= '00000000'x THEN DO
CALL _Main()
CALL TR_CLOSEPROJECT(progresswindow)
END
IF app2 ~= '00000000'x THEN CALL TR_DELETEAPP(app2)
END
RETURN 0
/* Dateiparameter ermitteln alles einsortieren */
_Main:
List.0 = 0
PList.0 = 0
NList.0 = 0
i = 1
IF GType = "SFS0" THEN DO
MaxLen = MaxLen - 1
Len2 = 3
Text2 = localestring(WIN_RightField_SFS) /* 66 */
DO while List~=''
CALL TR_SETATTRIBUTE(progresswindow,7,'TRAT_Value',i)
parse var List fullname ':' List
parse var fullname filename '$' SlotNr
fileinfo=statef(SourceDelDir'/'fullname)
parse var fileinfo . size . protbits days minutes ticks
IF size > 0 THEN DO
Dopus GetFileType SourceDelDir"/"'"'fullname'"'
Type = RESULT
IF Length(Size) > 3 THEN
size = Left(Size,Length(Size)-3)||"."||Right(Size,3)
IF Length(Size) > 7 THEN
size = Left(Size,Length(Size)-7)||"."||Right(Size,7)
Size = Right(size,10)
Blanks = Copies(" ",MaxLen - Length(Filename))
Date = Translate(DATE('N',days),"."," ")
Std = Right(Trunc(Minutes/60),2,'0')
Min = Right(((Minutes/60-Std)*60),2,'0')
Sec = Right(Trunc(Ticks/50),2,'0')
List.i = FileName||Blanks||Size" "date" "Std":"Min":"Sec" "Type
NList.i = SlotNr
FList.i = Filename
i = i + 1
END
END
END
ELSE DO
MaxLen = 21
Len2 = 17
Text2 = localestring(WIN_RightField_PFS) /* 67 */
DO while List~=''
CALL TR_SETATTRIBUTE(progresswindow,7,'TRAT_Value',i)
parse var List fullname ':' List
parse var fullname filename '@' SlotNr
fileinfo=statef(SourceDelDir'/'fullname)
parse var fileinfo . size . protbits days minutes ticks
IF size > 0 THEN DO
Dopus GetFileType SourceDelDir"/"'"'fullname'"'
Type = RESULT
IF Length(Size) > 3 THEN
size = Left(Size,Length(Size)-3)||"."||Right(Size,3)
IF Length(Size) > 7 THEN
size = Left(Size,Length(Size)-7)||"."||Right(Size,7)
Size = Right(size,10)
Blanks = Copies(" ",MaxLen - Length(Filename) -4)
Date = Translate(DATE('N',days),"."," ")
Std = Right(Trunc(Minutes/60),2,'0')
Min = Right(((Minutes/60-Std)*60),2,'0')
Sec = Right(Trunc(Ticks/50),2,'0')
List.i = SlotNr" "FileName||Blanks||Size" "date" "Std":"Min":"Sec" "Type
NList.i = Filename
FList.i = Fullname
i = i + 1
END
END
END
list.0 = i-1
NList.0 = i-1
FList.0 = i-1
RETURN 0
/* ZielPfad festlegen */
_MakeDestPath:
Parse Arg DdirName
IF Upper(Right(Path,Length(DdirName)+1)) = Upper(DDirName)||"/" THEN Desti = "Ram:"
ELSE Desti = Path
RETURN
/* PrefsStart */
_PrefsStart:
PARSE ARG From
IF From = '' THEN From = 0
IF Exists(RddPrefs) THEN DO
IF from THEN DO
CALL TR_CLOSEPROJECT(ListView)
CALL TR_DELETEAPP(app)
address command 'rx 'RddPrefs' 1 'PrefsVersion
Call _LoadPrefs()
Call _Fenster1()
END
ELSE DO
address command 'rx 'RDDPrefs' 0 'Prefsversion
Call _LoadPrefs()
END
END
ELSE DO
VARI.0 = 1
VARI.1 = RDDPrefs
ReqTitle = localestring(ERROR_Title)
ReqText = "\nCouldn`t find\n%s\n\nI will use\nbuiltin defaults.\n"
Gadgets = "OK"
CALL _RequestChoice(ReqTitle,ReqText,VARI,Gadgets)
END
RETURN
/* Prefs */
_Prefs:
IF EXISTS(ENVPrefs) THEN DO
Vers = ""
CALL Open('PrefsFile',ENVPrefs,'R')
DO WHILE Upper(Vers) ~= Upper(PrefsVersion)
Vers = ReadLn('PrefsFile')
IF EOF('PrefsFile') THEN leave
END
CALL Close('PrefsFile')
IF vers = PrefsVersion THEN
CALL _LoadPrefs()
ELSE
Call _PrefsStart()
END
ELSE
IF EXISTS(RDDprefs) THEN
Call _PrefsStart()
ELSE DO
VARI.0 = 1
VARI.1 = RDDPrefs
ReqTitle = localestring(ERROR_Title)
ReqText = "\nCouldn`t find\n%s\n\nI will use\nbuiltin defaults.\n"
Gadgets = "Well"
CALL _RequestChoice(ReqTitle,ReqText,VARI,Gadgets)
END
RETURN
/* DefaultPrefs */
_TakeDefaultPrefs:
MinWidth = 56
MinLines = 8
DelDirName.3 = ""
TempDir = "Ram:T/"
SFSDeldirName = SFSDelDirNamePath'SFSDelDirName'
DeviceInfo = DeviceInfoPath'DeviceInfo'
RETURN
/* LoadPrefs */
_LoadPrefs:
CALL Open('PrefsFile',ENVprefs,'R')
DO i = 1 TO PrefsLines
Prefs.i = ReadLn('PrefsFile')
END
CALL Close('PrefsFile')
MinWidth = Prefs.1
MinLines = Prefs.2
DelDirName.3 = Prefs.3
TempDir = Prefs.4
SFSDeldirName = Prefs.5'SFSDelDirName'
DeviceInfo = Prefs.6'DeviceInfo'
RETURN
/* Guide */
_Guide:
IF language = "deutsch" THEN RDDGuide = RDDgGuide
ELSE RDDGuide = RDDeGuide
IF Exists(RDDGuide) THEN
command wait "DoubleClick" RDDGuide
ELSE
CALL _EasyRequest(localestring(Msg_Problem_Title),"Couldn`t find\n"RddGuide,VARI,"OK")
RETURN
/* Loadrexx() */
loadrexx:
PARSE ARG dir,file,store
IF dir ~= '' THEN DO
IF RIGHT(dir,1) = ':' THEN
file = dir||file
ELSE
file = dir||'/'||file
END
IF ~OPEN('rexxfile',file,'R') THEN
RETURN(0)
rexxtext = READCH('rexxfile',64000)
INTERPRET rexxtext
CALL CLOSE('rexxfile')
IF store ~= '' THEN
INTERPRET store '= rexxtext'
DROP rexxtext
RETURN(1)
/* Localestring() */
localestring:
PARSE ARG stringnumber
IF catalog ~= 0 THEN
RETURN(GETCATALOGSTR(catalog,stringnumber,strings.stringnumber))
ELSE
RETURN(strings.stringnumber)
/* Filerequester */
_FileRequest:
Parse ARG DestiDir, File, Titel, Pattern, Art, Modus, Icons
IF Art = 0 THEN DO
Auswahl = ASL_RequestFile(ListView,'SaveFile',,
"ASLFR_DrawersOnly" Art,
"ASLFR_DoSaveMode" Modus,
"ASLFR_InitialPattern" Pattern,
"ASLFR_DoPatterns" 1,
"ASLFR_RejectIcons" Icons,
"ASLFR_InitialDrawer" DestiDir,
"ASLFR_InitialFile" '"'File'"',
"ASLFR_TitleText" '"'Titel'"')
END
ELSE DO
Auswahl = ASL_RequestFile(ListView,'SaveFile',,
"ASLFR_DrawersOnly" Art,
"ASLFR_InitialDrawer" DestiDir,
"ASLFR_RejectPattern" Pattern,
"ASLFR_TitleText" '"'Titel'"')
END
RETURN
/* Missed Program */
_MissedProgram:
PARSE ARG Program
VARI.0 = 1
VARI.1 = Program
ReqText = localestring(ERROR_Missed_Program) /* 4 */
Gadgets = localestring(Button_Prefs_Cancel)
CALL _RequestChoice(ReqTitle,ReqText,VARI,Gadgets)
IF Open('ReqErg',"Ram:T/RDDReqerg",'R') THEN DO
IF ReadCh('ReqErg') = 1 THEN DO
IF Exists(RddPrefs) THEN
address command 'rx 'RddPrefs' 0'PrefsVersion
ELSE
CALL _EasyRequest(localestring(Msg_Problem_Title),"Couldn`t find\n"RddPrefs,VARI,"OK")
END
CALL Close('ReqErg')
END
RETURN
/* ---------- Routine zur Textausgabe mittels TR_EasyRequest() ------------ */
_EasyRequest:
Parse Arg ReqTitle, ReqText, VARI, Gadgets
DO WHILE POS('\n',ReqText) > 0
ReqText = Overlay(D2C(10),ReqText,Pos('\n',ReqText),2)
END
i = 0
IF VARI.0 > 0 & VARI.0 ~= 'VARI.0' THEN DO WHILE Pos('%s',ReqText) > 0
i = i + 1
ReqText = Insert(VARI.i,ReqText,Pos('%s',ReqText)+1)
ReqText = DelStr(ReqText,Pos('%s',ReqText),2)
END
IF VARI.0 ~= i THEN DO
Text = VARI.0" %s sent by program"||NL||,
i" %s found in string"||NL||NL||,
"Please contact the auhor"
CALL OPEN('Shell','CON:160/50/500/160/Problem/CLOSE/WAIT')
WriteLn('Shell','Stringsproblem:'||NL||NL||Text)
CALL CLOSE('Shell')
END
Meldung = TR_EasyRequest(app,,
ReqText,Gadgets,,
"TREZ_Title" '"'ReqTitle'"',
"TREZ_LockProject" WindowProject)
VARI.0 = 0
Gadgets = "OK"
RETURN (Meldung)
/* ------------ Routine zur Textausgabe mittels RequestChoice -------------- */
_RequestChoice:
Parse Arg ReqTitle, ReqText, VARI, Gadgets
/* Variablen einfügen */
i = 0
IF VARI.0 > 0 & VARI.0 ~= 'VARI.0' THEN DO WHILE Pos('%s',ReqText) > 0
i = i + 1
ReqText = Insert(VARI.i,ReqText,Pos('%s',ReqText)+1)
ReqText = DelStr(ReqText,Pos('%s',ReqText),2)
END
IF VARI.0 ~= i THEN DO
Text = VARI.0" %s sent by program"||NL||,
i" %s found in string"||NL||NL||,
"Please contact the auhor"
CALL OPEN('Shell','CON:160/50/500/160/Problem/CLOSE/WAIT')
WriteLn('Shell','Stringsproblem:'||NL||NL||Text)
CALL CLOSE('Shell')
END
RCText = ReqText
/* Catalog für Requestchoice aufbereiten */
IF Catalog ~= 0 THEN DO
DO i = 1 TO Length(RCText) +5
IF Substr(RCText,i,1) = NL THEN DO
RCText = Overlay('*',RCText,i)
RCText = Insert('n',RCText,i)
END
END
END
/* Strings aufbereiten */
DO WHILE POS('\n',ReqText) > 0
ReqText = Overlay(D2C(10),ReqText,Pos('\n',ReqText),2)
RCText = Overlay('*n',RCText,Pos('\n',RCText),2)
END
IF EXISTS('c:RequestChoice') THEN DO
Dosbefehl = "C:RequestChoice >Ram:T/RDDReqerg "||,
D2C(32)||D2C(34)||,
ReqTitle||,
D2C(34)||D2C(32)||D2C(34)||,
RCText||,
D2C(34)||D2C(32)||D2C(34)||,
Gadgets||D2C(34)
ADDRESS COMMAND Dosbefehl
END
ELSE DO /* Wer RequestChoice nicht hat, bekommt eben eine Shell */
IF OPEN('Shell','CON:160/50/500/160/'ReqTitle'/CLOSE/WAIT') THEN DO
WriteLn('Shell',ReqTitle||NL||NL||' 'ReqText)
CALL CLOSE('Shell')
END
END
/* ReqTexte in Ram:RDD.Fehler speichern: */
IF ReqTitle == "Early RecoverDelDir Error" THEN DO
IF EXISTS("Ram:E-RDD.error") THEN
CALL OPEN('EText',"Ram:E-RDD.error",'A')
ELSE
CALL OPEN('EText',"Ram:E-RDD.error",'W')
WriteLn('EText',Script)
WriteLn('EText',GName' ('Device') Format: 'GType' Destination: 'Desti)
WriteLn('EText','Last Button Nr.: 'event.trm_id||D2C(10))
WriteLn('EText',ReqTitle||NL||NL||' 'ReqText||NL)
CALL CLOSE('EText')
lister set source_handle.0 busy 0
Setclip('RecoverDelDir',1)
EXIT(20)
END
ELSE DO
IF EXISTS(localestring(SCRIPTERROR_FileName)) THEN
CALL OPEN('ErrorText',localestring(SCRIPTERROR_FileName),'A') /* 78 */
ELSE
CALL OPEN('ErrorText',localestring(SCRIPTERROR_FileName),'W')
WriteLn('ErrorText',Copies("-",Length(SourceLine(1))))
WriteLn('ErrorText',SourceLine(1))
WriteLn('ErrorText',Copies("-",Length(SourceLine(1)))||NL)
WriteLn('ErrorText',Script)
WriteLn('ErrorText','Device : 'GName' ('Device')')
WriteLn('ErrorText','Format : 'GType)
WriteLn('ErrorText','Source : 'SourceDelDir)
WriteLn('ErrorText','Destination : 'Desti)
WriteLn('ErrorText','Last Button Nr.: 'event.trm_id||NL)
IF exists(EnvPrefs) THEN DO
CALL Open('PrefsFile',ENVprefs,'R')
DO i = 1 TO PrefsLines
Prefs.i = ReadLn('PrefsFile')
WriteLn('ErrorText','Prefs.'i' : 'Prefs.i)
END
CALL Close('PrefsFile')
END
ELSE
WriteLn('ErrorText','Used intern prefs')
WriteLn('ErrorText',NL||ReqTitle||NL||NL||ReqText||NL)
CALL CLOSE('ErrorText')
END
Setclip('RecoverDelDir',1)
lister set source_handle.0 busy 0
RETURN
/* ----------------- Im Falle eines Script-Fehlers hier hin springen ---------------- */
break_c:
failure:
halt:
ioerr:
syntax:
Line = sigl
ErrorSourceLine = ' '||Translate(Strip(SOURCELINE(Line),'B'),D2C(39),D2C(34))
IF Length(ErrorSourceLine) > 40 THEN DO
Len1 = Trunc(Length(ErrorSourceLine) / 2)
Len2 = Length(ErrorSourceLine) - Len1
ErrorSourceLine = Left(ErrorSourceLine,Len1)||"\n "||Right(ErrorSourceLine,Len2)
END
ReqTitle = localestring(SCRIPTERROR_Title) /* 73 */
ReqText = localestring(SCRIPTERROR_Body_1) /* 74 */
Gadgets = localestring(SCRIPTERROR_B0) /* 77 */
VARI.0 = 4
VARI.1 = rc
VARI.2 = ERRORTEXT(rc)
VARI.3 = Line
VARI.4 = ErrorSourceLine
CALL _RequestChoice(ReqTitle,ReqText,VARI,Gadgets)
lister set source_handle.0 busy 0
IF app ~= '00000000'x THEN CALL TR_DELETEAPP(app)
IF app2 ~= '00000000'x THEN CALL TR_DELETEAPP(app2)
Setclip('RecoverDelDir',1)
IF catalog ~= 0 THEN CALL CLOSECATALOG(catalog)
EXIT(20)